package com.catazy.wanandroid.module_login.repository

import com.catazy.wanandroid.common_base.constants.Constants
import com.catazy.wanandroid.common_base.ext.Prefs
import com.catazy.wanandroid.module_login.bean.LoginData
import dagger.hilt.android.scopes.ActivityRetainedScoped
import javax.inject.Inject


/**
 *  author: wangyb
 *  date: 3/30/21 2:36 PM
 *  description: todo
 */
@ActivityRetainedScoped
class RegisterLoginLocalRepository @Inject constructor(){


    fun insertLoginData(loginData: LoginData?) {
        if (loginData == null) return
        Prefs.put(Constants.USER_NAME, loginData.username)
        Prefs.put(Constants.USER_ID, loginData.id.toString())
    }

    companion object {
        val instance: RegisterLoginLocalRepository by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
            RegisterLoginLocalRepository()
        }
    }
}